package com.seven.first.ms.base;

import com.github.pagehelper.PageInfo;
import com.seven.first.suite.base.BaseDTO;
import com.seven.first.suite.base.BasePO;
import com.seven.first.suite.base.QueryDTO;
import com.seven.first.suite.result.ApiResult;

import java.util.List;
import java.util.Optional;

/**
 * @author seven
 */
public interface BaseService<PO extends BasePO, DTO extends BaseDTO, QUERY extends QueryDTO> {

    ApiResult<PO> insert(PO po);

    ApiResult<DTO> insertDTO(DTO dto);

    ApiResult<PO> update(PO po);

    ApiResult<PO> updateByPrimaryKeySelective(PO po);

    ApiResult<DTO> updateDTO(DTO dto);

    ApiResult<DTO> updateByPrimaryKeySelective(DTO dto);

    Optional<PO> findById(Long id);

    ApiResult<DTO> findDTOById(Long id);

    ApiResult<PageInfo<DTO>> selectDTOPage(QUERY query);

    public List<DTO> list(QUERY query);

    public List<PO> listPO(QUERY query);

    ApiResult<Integer> deleteLogicallyByIds(List<Long> ids);

    ApiResult<Integer> recoveryLogicallyByIds(List<Long> ids);

}
